home *** CD-ROM | disk | FTP | other *** search
- /*
- * the class DRAW_BMP_INFO
- * Copyright (C) 1996, 1997 Kazutaka Hirata <khirata@jove.acs.unt.edu>
- */
-
- #include "stdafx.h"
-
- #include "kbandef.h"
-
- #include "drawbmp.h"
-
- DRAW_BMP_INFO::DRAW_BMP_INFO(const XY& ac_min, const XY& ac_max, int dpi_design, int dpi_bmp)
- {
- m_mat_size = double(dpi_bmp) / double(dpi_design);
- m_pc_design_size = XY(XYT(X_SIZE * m_mat_size), XYT(Y_SIZE * m_mat_size));
- XY pc_min_dis = ac_min * m_mat_size;
- XY pc_max_dis = ac_max * m_mat_size;
- XY pc_min_src = XY(pc_min_dis.x(), m_pc_design_size.y() - pc_min_dis.y());
- XY pc_max_src = XY(pc_max_dis.x(), m_pc_design_size.y() - pc_max_dis.y());
- XY pc_min = get_min(pc_min_src, pc_max_src);
- XY pc_max = get_max(pc_min_src, pc_max_src);
- m_pc_win_base = pc_min;
- m_pc_win_size = pc_max - pc_min + 1;
- }
-
- XYT DRAW_BMP_INFO::xmin(void) const { return 0; }
- XYT DRAW_BMP_INFO::xmax(void) const { return pc_win_size().x() - 1; }
- XYT DRAW_BMP_INFO::ymin(void) const { return 0; }
- XYT DRAW_BMP_INFO::ymax(void) const { return pc_win_size().y() - 1; }
-
- XYT DRAW_BMP_INFO::distance_ac2pc(XYT ac) const
- {
- return XYT(ac * m_mat_size);
- }
-
- void DRAW_BMP_INFO::xy_ac2pc(const XY& ac, XY& pc) const
- {
- XY pc_math = ac * m_mat_size;
- pc.set_x( pc_math.x());
- pc.set_y(m_pc_design_size.y() - pc_math.y());
- pc -= m_pc_win_base;
- }
-
- XY DRAW_BMP_INFO::pc_win_size(void) const
- {
- return m_pc_win_size;
- }
-
- COLORREF DRAW_BMP_INFO::get_grid_color(void) const
- {
- return RGB(255, 255, 255);
- }
-
- COLORREF DRAW_BMP_INFO::get_cursor_color(void) const
- {
- return RGB(255, 255, 255);
- }
-
- COLORREF DRAW_BMP_INFO::get_target_color(void) const
- {
- return RGB(255, 255, 255);
- }
-
- COLORREF DRAW_BMP_INFO::get_erase_color(void) const
- {
- return RGB(255, 255, 255);
- }
-
- COLORREF DRAW_BMP_INFO::get_layer_color(int layer) const
- {
- return RGB( 0, 0, 0);
- }
-